﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChessBoard
{
    public class ChessPiece
    {
        public Dictionary<PieceType, string[]> Image { get; set; }

        public ChessPiece()
        {
            this.Image = LoadChessImages();
        }

        private Dictionary<PieceType, string[]> LoadChessImages()
        {
            Dictionary<PieceType, string[]> chessPieces = new Dictionary<PieceType, string[]>();
            chessPieces.Add(PieceType.King, PieceImage.King);
            chessPieces.Add(PieceType.Queen, PieceImage.Queen);
            chessPieces.Add(PieceType.Rook, PieceImage.Rook);
            chessPieces.Add(PieceType.Bishop, PieceImage.Bishop);
            chessPieces.Add(PieceType.Knight, PieceImage.Knight);
            chessPieces.Add(PieceType.Pawn, PieceImage.Pawn);
            chessPieces.Add(PieceType.None, PieceImage.None);
            return chessPieces;
        }

        public void Draw(PieceType name, int x, int y)
        {
            Console.SetCursorPosition(x, y);
            string[] image = this.Image[name];

            for (int row = 0; row < image.Length; row++)
            {
                Console.CursorLeft = x;
                Console.WriteLine(image[row]);
            }
        }
    }
}